home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / FWClpCmd.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.0 KB  |  112 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWClpCmd.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWCLPCMD_H
  11. #define FWCLPCMD_H
  12.  
  13. #ifndef FWCMD_H
  14. #include "FWCmd.h"
  15. #endif
  16.  
  17. #ifndef FWPASTA_H
  18. #include "FWPasta.h"
  19. #endif
  20.  
  21. // ----- OpenDoc Includes -----
  22.  
  23. #ifndef FWODTYPS_H
  24. #include "FWODTyps.h"
  25. #endif
  26.  
  27. #ifndef SOM_ODDraft_xh
  28. #include <Draft.xh>
  29. #endif
  30.  
  31. //========================================================================================
  32. //    Forward Declarations
  33. //========================================================================================
  34.  
  35. class FW_CPart;
  36. class FW_CFrame;
  37. class FW_CSelection;
  38. class ODClipboard;
  39. class FW_CLinkDestination;
  40.  
  41. //========================================================================================
  42. // FW_CClipboardCommand - handles Cut, Clear, Paste, PasteAs commands
  43. //                          Subclass to make these commands Undo-able
  44. //========================================================================================
  45.  
  46. class FW_CClipboardCommand : public FW_CCommand
  47. {
  48. public:
  49.     FW_DECLARE_AUTO(FW_CClipboardCommand)
  50.  
  51. //----------------------------------------------------------------------------------------
  52. //    Constructors/Destructor
  53. //
  54. public:
  55.     FW_CClipboardCommand(Environment* ev,
  56.                          ODCommandID id,
  57.                          FW_CFrame* frame,
  58.                          FW_Boolean canUndo);
  59.         // Constructor: undo/redo strings = NULL
  60.  
  61.     virtual ~ FW_CClipboardCommand();
  62.  
  63. //----------------------------------------------------------------------------------------
  64. //    Inherited API
  65. //
  66. public:
  67.     // --- Don't override ---
  68.     virtual void         DoIt(Environment* ev);
  69.  
  70.     // --- Override, call Inherited ---
  71.     virtual void         UndoIt(Environment* ev);
  72.     virtual void         RedoIt(Environment* ev);
  73.  
  74. protected:
  75.     virtual FW_Boolean    IsOKtoEdit(Environment* ev);
  76.  
  77. //----------------------------------------------------------------------------------------
  78. //    New API
  79. //
  80. public:
  81.     // --- May override, don't call Inherited ---
  82.     virtual void         PreCommand(Environment* ev);
  83.     virtual void         CommandDone(Environment* ev);
  84.  
  85.     virtual void        Clear(Environment* ev);
  86.     virtual void        Copy(Environment* ev);
  87.     virtual void        Cut(Environment* ev);
  88.     virtual FW_Boolean    Paste(Environment* ev);
  89.     virtual FW_Boolean    PasteAs(Environment* ev);
  90.  
  91.     void                PrivAddEndAction(Environment* ev);    // used in cross-document Paste As Link
  92.  
  93. protected:
  94.     FW_CLinkDestination* GetNewLink(Environment* ev) const;
  95.  
  96. private:
  97.     FW_Boolean            PrivPaste(Environment* ev);
  98.     void                PrivCopy(Environment* ev, FW_Boolean allowLink);
  99.     FW_Boolean            PrivWasLinkEstablished(Environment* ev);
  100.  
  101. //----------------------------------------------------------------------------------------
  102. //    Data Members
  103. //
  104. protected:
  105.     ODUpdateID            fUpdateID;            // update id of clipboard for Cut, Paste
  106.     ODCloneKind            fCloneKind;            // cloneKind of operation
  107.     FW_MPasteAsHandler*    fPasteAsHandler;    // used for Paste As command
  108.     FW_CSelection*        fSelection;
  109. };
  110.  
  111. #endif
  112.